<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
	<jsp:include page="../inc_bootstrap.jsp"></jsp:include>
	<script type="text/javascript">

		$(function() {
			//先销毁表格
			$('#reportTable').bootstrapTable({
				url: "${ctx}/log/bootGrid",
				dataType: "json",
				method: 'get',
				cache: false,
				height: "auto",//
				striped: true,
				pagination: true,
				pageSize: 20,
				pageNumber:1,
				pageList: [10, 20, 50, 100, 200, 500],
				search: true,
				showColumns: true,
				showRefresh: true,
				clickToSelect: true,
				idField:'id',
				toolbar: "#toolbar",
				paginationHAlign: 'left',
				paginationDetailHAlign: 'right',
				sidePagination: "server", //表示服务端请求
				queryParamsType : "undefined",
				columns: [{field:"chk",checkbox:true},
					{field:"id",title:"email",align:"left",valign:"middle",sortable:"true",visible:false},
					{field:"username",title:"用户名",align:"left",valign:"middle",width:"50"},
					{field:"ip",title:"IP地址",align:"left",valign:"middle",width:"100"},
					{field:"params",title:"参数",align:"left",valign:"middle",width:"400"},
					{field:"descriptions",title:"描述",align:"center",valign:"middle",width:"100"},
					{field:"module",title:"模块",align:"center",valign:"middle",width:"100"},
					{field:"method",title:"方法",align:"center",valign:"middle",width:"100"},
					{field:"createtime",title:"操作时间",align:"center",valign:"middle",width:"100"}
				],
				onPageChange: function (size, number) {
					$('#reportTable').bootstrapTable('resetWidth');
					//$("#pageSizeInput").val(size);
					//$("#pageNumberInput").val(number);
					//var form = $('#tableForm');
					//form.action= '${base}/showReport';
					//form.submit();
				},
				onSort: function (name, order) {
				},
// 			formatShowingRows: function (pageFrom, pageTo, totalRows) {
// 				return '';
//             },
// 			formatRecordsPerPage: function () {
// 				return '';
//             },
				formatNoMatches: function(){
					return '无符合条件的记录';
				}
			});
			$(window).resize(function () {
				$('#reportTable').bootstrapTable('resetView');
			});
		});
		function getSelect(){
			var rows = getIdSelections();
			window.location.href='${ctx}/log/view?id='+rows;
		}
		function getIdSelections() {
			return $.map($('#reportTable').bootstrapTable('getSelections'), function(row) {
				return row.id
			});
		}
	</script>
</head>
<body style="width:100%">
<jsp:include page="../head.jsp"></jsp:include>
<div id="content" class="divBox">
	<div id="content-body">
		<div id="reportTableDiv" class="span10">
			<table id="reportTable">
			</table>
		</div>
	</div>
</div>
<div id="toolbar">
	<input type="button" class="query" value="查看" onclick='getSelect()'/>
</div>
<jsp:include page="../footer.jsp"/>
</body>
</html>